package com.example.controller.flowable;
import com.example.service.flowable.IEvectionService;
import com.example.vo.ResultVo;
import com.example.vo.process.EvectionVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 出差流程控制类
 * @author wsl
 */
@RestController
@RequestMapping("/process/evection")
@Api(tags = "流程管理-出差")
public class EvectionController {

    @Autowired
    private IEvectionService evectionService;

    @PostMapping("/create")
    @ApiOperation(value = "新建出差流程")
    public ResultVo createEvectionProcess(@RequestBody EvectionVo evectionVo){
        return evectionService.createEvectionProcessInstance(evectionVo);
    }

    @GetMapping("/personal-evection-apply")
    @ApiOperation(value = "查看我的出差申请进度")
    public ResultVo queryMyEvectionApply(String userId){
        return evectionService.queryMyEvectionApply(userId);
    }

    @GetMapping("/evection-apply-detail")
    @ApiOperation(value = "查看我的出差申请详情")
    public ResultVo queryEvectionApplyDetail(String processInstanceId){
        return evectionService.queryEvectionApplyDetail(processInstanceId);
    }

    @GetMapping("/audit-task")
    @ApiOperation(value = "查看我的出差审批任务")
    public ResultVo queryAuditTask(@RequestParam String userId){
        return evectionService.queryEvectionAuditTask(userId);
    }

    @PutMapping("/complete-task")
    @ApiOperation(value = "完成出差审批")
    public ResultVo completeEvectionAduit(@RequestParam("taskId") String taskId,@RequestParam("approved") Boolean approved, String reply){
        return evectionService.completeEvectionAudit(taskId,approved,reply);
    }

    @GetMapping("/accreditation-detail")
    @ApiOperation(value = "查看任务详情")
    public ResultVo queryTaskDetail(String taskId){
        return evectionService.queryTaskDetail(taskId);
    }

    //    @GetMapping("/assessing-officer")
//    @ApiOperation(value = "获取审批人员列表")
//    public ResultVo getAssessingOfficer(String userId){
//        return evectionService.getAssessingOfficer(userId);
//    }

//    @PutMapping("/audit")
//    @ApiOperation(value = "审批流程")
//    public ResultVo auditEvectionProcess(String taskId, Map<String,Object> ){
//        return evectionService.auditEvectionProcess(taskId);
//    }
}
